#include<string.h>
#include<stdio.h>

char **divideString(char *s, int k, char fill, int *returnSize)
{
    int i = 0, j = 0, len = strlen(s), size;
    size = len % k == 0 ? len / k : len / k + 1;
    *returnSize = size;
    char **ans = (char **)malloc(sizeof(char *) * size);
    while (i < len)
    {
        ans[j] = (char *)malloc(sizeof(char) * (k + 1));
        memcpy(ans[j], s + i, sizeof(char) * fmin(k, len - i));
        ans[j][k] = '\0';
        if (len - i < k)
        {
            int a = len - i;
            while (a < k)
            {
                ans[j][a] = fill;
                a++;
            }
            ans[j][k] = '\0';
        }
        j++;
        i = i + k;
    }
    return ans;
}